package com.sushi.controller;

import com.sushi.service.FileService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.FileResp;
import com.sushi.request.FileReq;
import com.sushi.request.FilePageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

/**
 * 文件 控制器
 * @date 2023-05-02
 * @time 17:14:13
 * @author Administrator
 */
@RestController
@Slf4j
public class FileController {

	@Autowired
	private FileService fileService;

    

    /**
     * 新增
     */
    @PostMapping("/file/add")
    public ResponseBO<FileResp> add(@RequestBody FileReq req) {
        return fileService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/file/remove")
    public ResponseBO<FileResp> remove(@RequestBody FileReq req) {
        return fileService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/file/update")
    public ResponseBO<FileResp> update(@RequestBody FileReq req) {
        return fileService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/file/list")
    public ResponsePageBO<FileResp> list(@RequestBody FilePageReq req) {
        return fileService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/file/detail")
    public ResponseBO<FileResp> detail(@RequestBody FileReq req) {
        return fileService.detail(req);
    };

}